#ifndef VAR_H
#define VAR_H

#include "node.h"
#include "type.h"

class Var : public Node
{
public:
    Var(const QString& name, Node* expr, const Type& type, const YYLTYPE& loc);

    QString name() const { return m_name; }
    Node* initialValue() const { return m_expr; }

    virtual Type type() { return m_type; }

    bool isConstant() const;

private:
    static bool isConstant(const Node* n);

    QString m_name;
    Node* m_expr;
    Type m_type;
};

#endif // VAR_H
